<!--
 * @Date: 2020-05-21 21:04:38
 * @LastEditors: 杨光辉(GerhardYang)
 * @LastEditTime: 2021-06-04 12:17:35
 * @FilePath: \hubei-police-search\src\components\Header\index.vue
 * @Description: 系统标题组件
-->
<template>
  <div class="header">
    <div class="header-logo" @click="goBack"></div>
    <span class="header-title" @click="goBack">时空信息支撑平台</span>

    <Timebar class="timebar"></Timebar>
    <!-- <div class="layers">显示图层</div> -->
    <div class="user">
      <!-- <a-icon type="user" /> -->
      <!-- <span class="welcome" v-if="isLogin">欢迎您：</span>
      <span class="username" v-if="isLogin">{{ userId }}</span>-->
      <span class="action" v-if="isLogin">
        <a class="logout_title" href="javascript:;">
          <a-icon type="logout" />
          <span>&nbsp;退出登录</span>
        </a>
      </span>
      <span class="username" v-if="!isLogin" @click="onLogin"
        >登录查询更多</span
      >
    </div>
  </div>
</template>

<script>
import Timebar from "./Timebar";

export default {
  computed: {
    // 判断当前用户是否登录
    isLogin() {
      return this.$store.state.isLogin;
    },
    userId() {
      return this.$store.state.userId;
    },
  },
  components: {
    Timebar,
  },
  mounted() {},
  methods: {
    // 返回首页
    goBack() {
      window.location.href = this.$store.state.Config2D.HomeURL;
    },
    onLogin() {
      window.location.href = this.$store.state.Config2D.LoginURL;
    },
  },
};
</script>

<style lang="less" scoped>
.header {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 60px;
  z-index: 99;
  background-color: @themeBackgroundColor;

  .header-logo {
    cursor: pointer;
    margin-top: 14px;
    margin-left: 8px;
    float: left;
    width: 40px;
    height: 32px;
    background-image: url("../../assets/imgs/gis_logo.png");
    background-size: cover;
  }

  .header-title {
    float: left;
    cursor: pointer;
    font-size: 22px;
    color: @themeFontColor;
    font-weight: 600;
    line-height: 60px;
    font-family: MicrosoftYaHei-Bold;
    font-stretch: normal;
    letter-spacing: 0px;
  }

  // 时间组件使用LED字体
  .timebar {
    color: @themeFontColor;
    float: right;
    margin-top: 14px;
    margin-right: 10px;
    font-size: 22px;
    font-weight: 300;
    font-family: "LED";
    width: 180px;
  }
  .layers {
    float: right;
  }

  .user {
    float: right;
    margin-right: 20px;
    font-weight: 300;
    width: 150px;

    line-height: 60px;
    text-align: right;
    font-weight: 900;

    .welcome {
      color: @themeFontColor;
      font-size: 13px;
    }

    .username {
      font-size: 14px;
      color: @themeFontColor;
      cursor: pointer;
    }

    .username:hover {
      font-size: 15px;
      text-shadow: 5px 5px 5px #6699ff;
    }
    .action {
      .logout_title {
        font-size: 14px;
        color: @themeFontColor;
        cursor: pointer;
      }
    }
  }
}
</style>
